/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.eventos.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author lizardo
 */
@Entity
@Table(name = "eca_material_academico")
@NamedQueries({@NamedQuery(name = "MaterialAcademico.findAll", query = "SELECT m FROM MaterialAcademico m"), @NamedQuery(name = "MaterialAcademico.findByMacCodigo", query = "SELECT m FROM MaterialAcademico m WHERE m.macCodigo = :macCodigo"), @NamedQuery(name = "MaterialAcademico.findByMacTitulo", query = "SELECT m FROM MaterialAcademico m WHERE m.macTitulo = :macTitulo"), @NamedQuery(name = "MaterialAcademico.findByMacTema", query = "SELECT m FROM MaterialAcademico m WHERE m.macTema = :macTema"), @NamedQuery(name = "MaterialAcademico.findByMacObjectivos", query = "SELECT m FROM MaterialAcademico m WHERE m.macObjectivos = :macObjectivos")})
public class MaterialAcademico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "mac_codigo")
    private Integer macCodigo;
    @Basic(optional = false)
    @Column(name = "mac_titulo")
    private String macTitulo;
    @Basic(optional = false)
    @Column(name = "mac_tema")
    private String macTema;
    @Column(name = "mac_objectivos")
    private String macObjectivos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "macCodigo", fetch = FetchType.LAZY)
    private List<DetalleMaterial> detalleMaterialList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "macCodigo", fetch = FetchType.LAZY)
    private List<EntregaMaterial> entregaMaterialList;
    @JoinColumn(name = "cur_codigo", referencedColumnName = "cur_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Curso curCodigo;

    public MaterialAcademico() {
    }

    public MaterialAcademico(Integer macCodigo) {
        this.macCodigo = macCodigo;
    }

    public MaterialAcademico(Integer macCodigo, String macTitulo, String macTema) {
        this.macCodigo = macCodigo;
        this.macTitulo = macTitulo;
        this.macTema = macTema;
    }

    public Integer getMacCodigo() {
        return macCodigo;
    }
    public void setMacCodigo(Integer macCodigo) {
        this.macCodigo = macCodigo;
    }

    public String getMacTitulo() {
        return macTitulo;
    }
    public void setMacTitulo(String macTitulo) {
        this.macTitulo = macTitulo;
    }

    public String getMacTema() {
        return macTema;
    }
    public void setMacTema(String macTema) {
        this.macTema = macTema;
    }

    public String getMacObjectivos() {
        return macObjectivos;
    }
    public void setMacObjectivos(String macObjectivos) {
        this.macObjectivos = macObjectivos;
    }

    public List<DetalleMaterial> getDetalleMaterialList() {
        return detalleMaterialList;
    }
    public void setDetalleMaterialList(List<DetalleMaterial> detalleMaterialList) {
        this.detalleMaterialList = detalleMaterialList;
    }

    public List<EntregaMaterial> getEntregaMaterialList() {
        return entregaMaterialList;
    }
    public void setEntregaMaterialList(List<EntregaMaterial> entregaMaterialList) {
        this.entregaMaterialList = entregaMaterialList;
    }

    public Curso getCurCodigo() {
        return curCodigo;
    }
    public void setCurCodigo(Curso curCodigo) {
        this.curCodigo = curCodigo;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (macCodigo != null ? macCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaterialAcademico)) {
            return false;
        }
        MaterialAcademico other = (MaterialAcademico) object;
        if ((this.macCodigo == null && other.macCodigo != null) || (this.macCodigo != null && !this.macCodigo.equals(other.macCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.eventos.be.MaterialAcademico[macCodigo=" + macCodigo + "]";
    }


}
